package org.invigorare;
import java.util.*;
import java.util.Map.Entry;

public class MapUtils<K,V> {

	public Map<V,K> invertedMap(Map<K,V> map) {
		Map<V,K> out = new HashMap<V,K>(map.size());
		
		Set<Entry<K,V>> entrySet = map.entrySet();
		for (Entry<K,V> entry : entrySet) {
			out.put(entry.getValue(), entry.getKey());
		}
		
		return out;
	}
	
	public List<V> mapAll(Map<K,V> map, K[] keys) {
		List<V> outs = new ArrayList<V>();
		
		for (K k : keys) {
			outs.add(map.get(k));
		}
		
		return outs;
	}
	
}
